import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'path';
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { NaiveUiResolver } from 'unplugin-vue-components/resolvers'

const options = {
  base: "/agents/aiw-agent-demo",
  server: {
    host: "0.0.0.0",
    port: 4002,
  },
  build: {
    outDir: "aiw-agent-demo",
  },
  plugins: [
    vue(),
    AutoImport({
      imports: [
        'vue',
        {
          'naive-ui': [
            'useDialog',
            'useMessage',
            'useNotification',
            'useLoadingBar'
          ]
        }
      ]
    }),
    Components({
      resolvers: [NaiveUiResolver()]
    })
  ],
  resolve: {
    alias: {
      '@': path.resolve(__dirname, './src/'),
      '@com': path.resolve(__dirname, './src/components/'),
    },
    extensions: ['.js', '.json'] // 使用路径别名时想要省略的后缀名，可以自己 增减
  },
}

export default defineConfig(({ command, mode }) => {
  console.log(`========= mode ${mode} ========= 命令 ${command}=======`);
  if (mode === 'development') {
    
  } else if (mode === 'production' || mode === 'sit') {
    
  }
  return options;
});
